#include <iostream>

#include "CMD5.h"

using namespace std;

int main(int argc, char **argv)
{
	if(argc<2) {
		cerr << "Usages : " << argv[0] << " <msg>" << endl;
		exit(-1);
	}

  unsigned char digest[32];
  
  CMD5 *md5 = new CMD5();
  md5->GetMD5MessageToHex(argv[1],digest);
  delete md5;

  char tmp[256];
  string st = "";
  for(int i=0;i<16;i++) {
	sprintf(tmp, "%02x",digest[i]);
	st += tmp;
  }

  cout << st << endl;

  //string sdigest = (char *) digest;
  //sdigest = sdigest.substr(1,sdigest.length()-2);

  //cout << sdigest << endl;
}
//---------------------------------------------------------------------------
